/*
 * Copyright (c) 2022  by Junzhao
 * THIS FILE IS PART OF JAVASE Song Huongkang PROJECT
 * All Rights Reserved.
 */

import java.util.Arrays;

/**
 * 冒泡排序
 * @author 俊昭
 * @version 1.0 2022年3月10日20:48:58
 *
 */
 class popsort {
    public static void main(String []args){
        //示例数组
        int[] arr = new int[]{1,23,21,45,23,54,24,54,84,67,86};
        arr = sort1(arr);
        System.out.println(Arrays.toString(arr));




    }
    public static int[] sort1(int [] arr){
        for (int i = 0;i< arr.length -1 ;i++){
            for (int j = 0;j< arr.length - 1 - i;j++){
                if (arr[j]>arr[j+1]){

                    int temp = arr[j+1];
                    arr[j+1] = arr[j];
                    arr[j]= temp;
                }
            }
        }
        return arr;
    }
}
